<template>
	<view class="page_box1">
		<view class="header" style="color: #000000;" @tap="goBack()">
			<view class="arrow">
			</view>
			<view class="title">
				图册审核
			</view>
		</view>


		<view class="">
			<u-tabs :list="list"
				:is-scroll="false"
				:current="current"
				font-size="30rpx"
				@change="change"
				bar-width="72"
				active-color="#4F5394">
			</u-tabs>
		</view>
		
		<block v-if="current == 0">
			<view class="wh100 h260 padTap"
				style="background-color: #FFFFFF;
				margin-top: 20rpx;"
				v-for="(item, index) in listFrom" :key="index">
				<view class=" flex justify-between align-center">
					<view class="">
						{{item.title}}
					</view>
					<view class="bgc w176 h50 text-center r35">
						审核中
					</view>
				</view>
				
				<view class="flex align-center" style="margin-top: 10rpx;">
					<view class="">
						<image class="w140 h140 r10"
							:src="img + item.image" mode=""></image>
					</view>
					<view class="" style="margin-left: 10rpx;
						color: #717171; font-size: 26rpx;line-height: 50rpx;">
						<view class="">
							<u-icon name="clock"></u-icon>
							上传时间: {{item.createtime}}
							<!-- {{$u.timeFormat(item.createtime, 'yyyy-mm-dd ')}} -->
						</view>
						<view class="">
							<u-icon name="map"></u-icon>
							地址:{{item.address}}
						</view>
					</view>
				</view>
			</view>
		</block>
		
		
		<block v-if="current == 1">
			<view class="wh100 h260 padTap"
				style="background-color: #FFFFFF;
				margin-top: 20rpx;"
				v-for="(item, index) in listFrom" :key="index">
				<view class=" flex justify-between align-center">
					<view class="">
					{{item.title}}
					</view>
					<view class="bgc w176 h50 text-center r35">
						审核成功
					</view>
				</view>
				
				<view class="flex align-center" style="margin-top: 10rpx;">
					<view class="">
						<image class="w140 h140 r10"
							:src="img + item.image" mode=""></image>
					</view>
					<view class="" style="margin-left: 10rpx;
						color: #717171; font-size: 26rpx;line-height: 50rpx;">
						<view class="">
							<u-icon name="clock"></u-icon>
							上传时间: {{item.createtime}}
						</view>
						<view class="">
							<u-icon name="map"></u-icon>
							地址:{{item.address}}
						</view>
					</view>
				</view>
			</view>
		</block>
		
		
		
		<block v-if="current == 2">
			<view class="wh100 h260 padTap"
				style="background-color: #FFFFFF;
				margin-top: 20rpx;"
				v-for="(item, index) in listFrom" :key="index">
				<view class=" flex justify-between align-center">
					<view class="">
						{{item.title}}
					</view>
					<view class="bgc w176 h50 text-center r35" @tap="addCheclout(item.id)">
						重新提交
					</view>
				</view>
				
				<view class="flex align-center" style="margin-top: 10rpx;">
					<view class="">
						<image class="w140 h140 r10"
							:src="img + item.image" mode=""></image>
					</view>
					<view class="" style="margin-left: 10rpx;
						color: #717171; font-size: 26rpx;line-height: 50rpx;">
						<view class="">
							<u-icon name="clock"></u-icon>
							上传时间: {{item.createtime}}
						</view>
						<view class="">
							<u-icon name="map"></u-icon>
							地址:{{item.address}}
						</view>
					</view>
				</view>
			</view>
		</block>



		<!-- 信息提示-->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
					name: '审核中'
				}, {
					name: '审核成功'
				}, {
					name: '审核失败',
				}],
				current: 0,
				listFrom: [],
				type: 1,
				img: this.$images,
			};
		},
		onShow() {},
		onLoad(e) {
			this.listFromInfo()
		},
		methods: {
			goBack(id) {
				uni.navigateBack({
					delta: 1
				})
			},

			change(index) {
				
				this.current = index;
				console.log(index)
				if (this.current == 0) {
					this.type = 1
					this.listFromInfo()
				} else if ( this.current == 1) {
					this.type = 2
					this.listFromInfo()
				} else if ( this.current == 2) {
					this.type = 3
					this.listFromInfo()
				}
			},
			
			async listFromInfo () {
				const res = await this.$u.post('api/hotel/verify',{
					uid: uni.getStorageSync('uid'),
					type: this.type,
				})
				this.listFrom = res.data
			},
			
			async addCheclout(id) {
				const res = await this.$u.post('api/hotel/cxsh',{
					id: id,
				})
				if (res.code == 1) {
					this.listFromInfo()
				}
				
				this.$tools.msg(res.msg)
				
			},
		}
	};
</script>

<style lang="scss" scoped>
	.page_box1 {
		height: 100%;
		width: 100%;
		// display: flex;
		// flex-direction: column;
		// justify-content: space-between;
		// overflow-x: hidden;
		background: #F8F8F8;
	}

	.header {
		width: 100%;
		height: 150rpx;
		line-height: 150rpx;
		display: flex;
		align-items: center;
		// padding-left: 10rpx;
		padding-top: 30rpx;
		font-size: 36rpx;
		font-family: PingFang SC;
		font-weight: 500;
		background: #FFFFFF;

		.arrow {
			position: relative;
			display: inline-block;
		}

		.arrow::before {
			content: '';
			width: 10px;
			height: 10px;
			border: 0px;
			border-bottom: solid 2px #2C2C2C;
			border-left: solid 2px #2C2C2C;
			-ms-transform: rotate(45deg);
			-webkit-transform: rotate(45deg);
			transform: rotate(45deg);
			position: absolute;
			top: 50%;
			left: 0;
			margin-top: -4px;
			margin-left: 28rpx;
		}

		.title {
			margin: 0 auto;
		}
	}
	
	.padTap {
		font-size: 30rpx;
		padding: 29rpx 22rpx;
		
		.bgc {
			color: #4F5394;
			line-height: 50rpx;
			background: rgba(234, 234, 242, 1);
		}
	}
</style>
